﻿// -----------------------------------------------------------------------
// Copyright (c) David Kean. All rights reserved.
// -----------------------------------------------------------------------
extern alias pcl;
using System;
using System.IO;
using System.Linq.Expressions;
using pcl::System.Diagnostics.Adaptation;

namespace Portable
{
    internal class IStopwatchFactory : MockFactory<IStopwatch>
    {
        public static IStopwatch Override(Expression<Action<IStopwatch>> action, Action value)
        {
            var mock = CreateMock();
            mock.Setup(action)
                .Callback(value);

            return mock.Object;
         
        }

        public static IStopwatch Override<TResult>(Expression<Func<IStopwatch, TResult>> action, TResult value)
        {
            var mock = CreateMock();
            mock.Setup(action)
                .Returns(value);
            
            return mock.Object;
        }
    }
}
